#ifndef PONG_H
#define PONG_H
#include <stdbool.h>
#include <signal.h>

int createUDPSocketAndBind(int port);

bool send_generic(int sockfd, struct sockaddr *sockInfo, PACKET *packet);

bool send_RRQ(int sockfd, struct sockaddr *sockInfo, char *filename, char *mode);
bool send_WRQ(int sockfd, struct sockaddr *sockInfo, char *filename, char *mode);

bool send_data(int sockfd, struct sockaddr *sockInfo, u_int16_t blockNumber, char *data, size_t data_size);

bool send_ack(int sockfd, struct sockaddr *sockInfo, u_int16_t blockNumber);

bool send_error(int sockfd, struct sockaddr *sockInfo, u_int16_t errorCode, char *error_message);

int waitForPacket(int sockfd, struct sockaddr *cli_addr, u_int16_t optcode, PACKET *packet);

#endif
